<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Email_template_model extends AppModel {
    var $_primary_key = EMAIL_TEMPLATE_ID;
    var $_tablename = EMAIL_TEMPLATE_TABLE;
    var $_mapping = array(
                           array('id' => EMAIL_TEMPLATE_ID),
                           array('key' => EMAIL_TEMPLATE_KEY),
                           array('subject' => EMAIL_TEMPLATE_SUBJECT),
                           array('body' => EMAIL_TEMPLATE_BODY),
                            );

    public function Email_template_model($id = NULL){
        parent::AppModel($id);
    }
    
    function get_by_key($key){
        $tpls = parent::get_lists(array(EMAIL_TEMPLATE_KEY => $key));
        if(!empty($tpls))
            return $tpls[0];
        else
            return FALSE;
    }
}
?>